<html>
<head><meta charset="utf-8"><title>u64_vs_usize · wg-cli · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/index.html">wg-cli</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html">u64_vs_usize</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224283791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/220302-wg-cli/topic/u64_vs_usize/near/224283791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Donough Liu <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html#224283791">(Jan 28 2021 at 04:41)</a>:</h4>
<p>I noticed that all of the number type in <code>Arg</code> is u64, why aren't they usize?</p>



<a name="226575510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/220302-wg-cli/topic/u64_vs_usize/near/226575510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html#226575510">(Feb 16 2021 at 20:59)</a>:</h4>
<p><span class="user-mention" data-user-id="294318">@Donough Liu</span> <code>usize</code> is appropriate for "size of an array or string or similar that fits in memory". It isn't appropriate for arbitrary numeric values.</p>



<a name="226575673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/220302-wg-cli/topic/u64_vs_usize/near/226575673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html#226575673">(Feb 16 2021 at 21:00)</a>:</h4>
<p>An arbitrary numeric command-line argument should not have a maximum size that varies by platform.</p>



<a name="226686824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/220302-wg-cli/topic/u64_vs_usize/near/226686824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Donough Liu <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html#226686824">(Feb 17 2021 at 16:47)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span>  All of the <code>u64</code> in the <code>Arg</code> is for array size. Changing them to usize doesn't affect a numeric argument's value range. <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="226690403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/220302-wg-cli/topic/u64_vs_usize/near/226690403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Donough Liu <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html#226690403">(Feb 17 2021 at 17:08)</a>:</h4>
<p>It's pretty internal though.</p>



<a name="226692204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/220302-wg-cli/topic/u64_vs_usize/near/226692204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html#226692204">(Feb 17 2021 at 17:20)</a>:</h4>
<p>Ah, sorry, I didn't realize you meant internal to a structure.</p>



<a name="226692298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/220302-wg-cli/topic/u64_vs_usize/near/226692298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html#226692298">(Feb 17 2021 at 17:21)</a>:</h4>
<p>Thanks for clarifying.</p>



<a name="226692339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/220302-wg-cli/topic/u64_vs_usize/near/226692339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/220302-wg-cli/topic/u64_vs_usize.html#226692339">(Feb 17 2021 at 17:21)</a>:</h4>
<p>Then yeah, <code>usize</code> sounds fine.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>